import React from 'react'
import UserModel from '../model/userModel'
interface IProps{
    list:Array<UserModel>,
    delListById:(id:number)=>void
}
export default function UserList({list,delListById}:IProps) {
  return ( <>  
    <div className='tr'>
        <div className='td'>编号</div>
        <div className='td'>用户名</div>
        <div className='td'>年龄</div>
        <div className='td'>操作</div>
    </div>
    {list.map(item=>{
        return <div className='tr' key={item.id}>
        <div className='td'>{item.id}</div>
        <div className='td'>{item.username}</div>
        <div className='td'>{item.userage}</div>
        <div className='td' onClick={()=>{
            // delListById(item.id as number);
            delListById(Number(item.id));
        }}>删除</div>
    </div> 

    })}
    </>

  )
}
